
package com.ami.kvm.jviewer.gui;

import com.ami.kvm.jviewer.Debug;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.SoftBevelBorder;

public class UserDefMacro extends JDialog {
	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JPanel buttonPanel = null;
	private JList jList = null;
	private JButton jAddButton = null;
	private JButton jDeleteButton = null;
	private JButton jCloseButton = null;
	private JDialog jAddDialog = null;
	private JLabel jAddLabel = null;
	private JTextArea jShowTextField = null;
	private JTextArea jUserInfo = null;
	private JButton jOKButton = null;
	private DefaultListModel model;
	private JScrollPane pane;
	private JButton jClearButton = null;
	private JButton jClearAllButton = null;
	private JButton jWindowsButton = null;
	private JButton jTabButton = null;
	private JButton jAltF4Button = null;
	private JButton jPrintScreen = null;

	private HashMap<String, String> macroMap;

	private HashMap<String, String> previousMap;

	private String code;
	private boolean addMacro = false;

	public static final int WIDTH = 615;

	public static final int HEIGHT = 355;

	private JScrollPane getJList() {
		if (this.jList == null) {
			this.model = new DefaultListModel();
			try {
				this.macroMap = JViewerApp.getInstance().getAddMacro().getMacroMap();
				if (this.macroMap != null) {
					Set localSet = this.macroMap.entrySet();

					Iterator localIterator = localSet.iterator();
					while (localIterator.hasNext()) {
						Map.Entry localEntry = (Map.Entry) localIterator.next();
						this.model.addElement(localEntry.getKey());
					}
					this.jList = new JList(this.model);
					this.pane = new JScrollPane(this.jList);
					this.jList.setBounds(new Rectangle(5, 5, 600, 270));
					this.pane.setBounds(new Rectangle(5, 5, 600, 270));
					this.jList.setVisible(true);
					this.pane.setVisible(true);
				}
			} catch (NullPointerException localNullPointerException) {
				Debug.out.println(localNullPointerException);
			}
		}
		return this.pane;
	}

	private JButton getJAddButton() {
		if (this.jAddButton == null) {
			this.jAddButton = new JButton();
			this.jAddButton.setText(LocaleStrings.getString("T_2_UDM"));
			this.jAddButton.setSize(this.jAddButton.getPreferredSize());
			this.jAddButton.setVisible(true);
			this.jAddButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					JViewerApp.getInstance().getAddMacro();
					if (UserDefMacro.this.model.size() < 20) {
						UserDefMacro.this.getJAddDialog();
						UserDefMacro.this.jShowTextField.setCaretPosition(0);
						UserDefMacro.this.jShowTextField.setRequestFocusEnabled(true);
						UserDefMacro.this.jShowTextField.requestFocus();
					} else {
						JOptionPane.showMessageDialog(JViewerApp.getInstance().getMainWindow(),
								LocaleStrings.getString("T_3_UDM") + 20 + LocaleStrings.getString("T_4_UDM"),
								LocaleStrings.getString("T_1_UDM"), 1);
					}
				}
			});
		}

		return this.jAddButton;
	}

	private JButton getJDeleteButton() {
		if (this.jDeleteButton == null) {
			this.jDeleteButton = new JButton();
			this.jDeleteButton.setText(LocaleStrings.getString("T_5_UDM"));
			this.jDeleteButton.setSize(this.jDeleteButton.getPreferredSize());
			this.jDeleteButton.setVisible(true);
			this.jDeleteButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					int[] arrayOfInt = UserDefMacro.this.jList.getSelectedIndices();
					Object[] arrayOfObject = UserDefMacro.this.jList.getSelectedValues();
					for (int i = 0; i < arrayOfInt.length; i++) {
						String str = (String) arrayOfObject[i];
						UserDefMacro.this.model.removeElement(str);
						UserDefMacro.this.macroMap.remove(str);
					}
				}
			});
		}
		return this.jDeleteButton;
	}

	private JButton getJCloseButton() {
		if (this.jCloseButton == null) {
			this.jCloseButton = new JButton();
			this.jCloseButton.setText(LocaleStrings.getString("T_6_UDM"));
			this.jCloseButton.setSize(this.jCloseButton.getPreferredSize());
			this.jCloseButton.setVisible(true);
			this.jCloseButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					UserDefMacro.this.onCloseDialog();
				}
			});
		}
		return this.jCloseButton;
	}

	public void onCloseDialog() {
		JViewerApp.getInstance().getAddMacro().setMacroMap(this.macroMap);
		JViewerApp.getInstance().getAddMacro().parseKeycodeSendBMC();

		JViewerApp.getInstance().getAddMacro().removeMacroMenu();
		JViewerApp.getInstance().getAddMacro().removeToolbarMacro();

		JViewerApp.getInstance().getAddMacro().addMacroMenu(this.macroMap);
		JViewerApp.getInstance().getAddMacro().addToolbarMacro(this.macroMap);
		this.addMacro = false;
		dispose();
	}

	private JDialog getJAddDialog() {
		if (this.jAddDialog == null) {
			this.jAddDialog = new JDialog(this);
			this.jAddDialog.setSize(new Dimension(650, 260));
			this.jAddDialog.setTitle(LocaleStrings.getString("T_7_UDM"));
			this.jAddDialog.getContentPane().setLayout(new GridBagLayout());
			GridBagConstraints localGridBagConstraints = new GridBagConstraints();
			localGridBagConstraints.fill = 2;
			localGridBagConstraints.insets = new Insets(2, 5, 5, 5);
			localGridBagConstraints.gridheight = 1;
			localGridBagConstraints.gridwidth = 1;
			localGridBagConstraints.gridx = 0;
			localGridBagConstraints.gridy = 0;
			localGridBagConstraints.weightx = 1.0D;
			this.jAddDialog.getContentPane().add(getUserInfoPanel(), localGridBagConstraints);
			localGridBagConstraints.insets = new Insets(5, 5, 5, 5);
			localGridBagConstraints.gridy = 1;
			this.jAddDialog.getContentPane().add(getMacroButtonPanle(), localGridBagConstraints);
			localGridBagConstraints.gridy = 2;
			this.jAddDialog.getContentPane().add(getMacroDispalyTextPanel(), localGridBagConstraints);
			localGridBagConstraints.insets = new Insets(5, 5, 2, 5);
			localGridBagConstraints.gridy = 3;
			this.jAddDialog.getContentPane().add(getControlButtonPanel(), localGridBagConstraints);

			this.jAddDialog.setResizable(false);
			this.jAddDialog.addWindowListener(new WindowAdapter() {
				public void windowClosing(WindowEvent paramAnonymousWindowEvent) {
					UserDefMacro.this.addMacro = false;
					UserDefMacro.this.jShowTextField.setText("");
					UserDefMacro.this.jAddDialog.dispose();
				}
			});
		}
		this.addMacro = true;
		this.jAddDialog.setVisible(true);
		this.jAddDialog.setLocation(JViewerApp.getInstance().getPopUpWindowPosition(650, 260));
		return this.jAddDialog;
	}

	private JPanel getUserInfoPanel() {
		JPanel localJPanel = new JPanel(new GridBagLayout());
		GridBagConstraints localGridBagConstraints = new GridBagConstraints();
		localGridBagConstraints.fill = 2;
		localGridBagConstraints.insets = new Insets(5, 5, 5, 5);
		localGridBagConstraints.gridheight = 1;
		localGridBagConstraints.gridwidth = 1;
		localGridBagConstraints.gridx = 0;
		localGridBagConstraints.gridy = 0;
		localGridBagConstraints.weightx = 1.0D;

		this.jAddLabel = new JLabel();
		this.jAddLabel.setText(LocaleStrings.getString("T_9_UDM"));
		this.jAddLabel.setSize(this.jAddLabel.getPreferredSize());
		localJPanel.add(this.jAddLabel, localGridBagConstraints);

		this.jUserInfo = new JTextArea();
		this.jUserInfo.setEditable(false);
		this.jUserInfo.setCursor(null);
		this.jUserInfo.setOpaque(false);
		this.jUserInfo.setFocusable(false);
		this.jUserInfo.setFont(new Font("Dialog", 1, 12));
		this.jUserInfo.setText(LocaleStrings.getString("T_8_UDM"));
		this.jUserInfo.setWrapStyleWord(true);
		this.jUserInfo.setSize(this.jUserInfo.getPreferredSize());
		localGridBagConstraints.gridy = 1;
		localJPanel.add(this.jUserInfo, localGridBagConstraints);

		return localJPanel;
	}

	private JPanel getMacroButtonPanle() {
		JPanel localJPanel = new JPanel(new GridBagLayout());
		GridBagConstraints localGridBagConstraints = new GridBagConstraints();
		localGridBagConstraints.fill = 2;
		localGridBagConstraints.insets = new Insets(5, 5, 5, 5);
		localGridBagConstraints.gridheight = 1;
		localGridBagConstraints.gridwidth = 1;
		localGridBagConstraints.gridx = 0;
		localGridBagConstraints.gridy = 0;

		localJPanel.add(getJWindowsButton(), localGridBagConstraints);
		localGridBagConstraints.gridx = 1;
		localJPanel.add(getJTabButton(), localGridBagConstraints);
		localGridBagConstraints.gridx = 2;
		localJPanel.add(getAltF4Button(), localGridBagConstraints);
		localGridBagConstraints.gridx = 3;
		localJPanel.add(getPrintScreen(), localGridBagConstraints);
		localGridBagConstraints.gridx = 4;
		localGridBagConstraints.weightx = 1.0D;
		localJPanel.add(new JPanel(), localGridBagConstraints);
		return localJPanel;
	}

	private JPanel getMacroDispalyTextPanel() {
		JPanel localJPanel = new JPanel(new GridBagLayout());
		GridBagConstraints localGridBagConstraints = new GridBagConstraints();
		localGridBagConstraints.fill = 2;
		localGridBagConstraints.insets = new Insets(5, 5, 5, 5);
		localGridBagConstraints.gridx = 0;
		localGridBagConstraints.gridy = 0;
		localGridBagConstraints.ipady = 10;
		localGridBagConstraints.weightx = 1.0D;
		localJPanel.add(getJShowTextField(), localGridBagConstraints);
		return localJPanel;
	}

	private JPanel getControlButtonPanel() {
		JPanel localJPanel = new JPanel(new GridBagLayout());
		GridBagConstraints localGridBagConstraints = new GridBagConstraints();
		localGridBagConstraints.fill = 2;
		localGridBagConstraints.insets = new Insets(5, 5, 5, 5);

		localGridBagConstraints.gridx = 0;
		localGridBagConstraints.gridy = 0;
		localGridBagConstraints.weightx = 1.0D;
		localJPanel.add(new JPanel(), localGridBagConstraints);
		localGridBagConstraints.weightx = 0.0D;
		localGridBagConstraints.gridx = 1;
		localJPanel.add(getJClearButton(), localGridBagConstraints);
		localGridBagConstraints.gridx = 2;
		localJPanel.add(getJClearAllButton(), localGridBagConstraints);
		localGridBagConstraints.gridx = 3;
		localJPanel.add(getJOKButton(), localGridBagConstraints);
		return localJPanel;
	}

	private JTextArea getJShowTextField() {
		if (this.jShowTextField == null) {
			this.jShowTextField = new JTextArea();
			this.jShowTextField.enableInputMethods(false);
			this.jShowTextField.setEditable(false);
			this.jShowTextField.setBorder(new SoftBevelBorder(1));

			this.jShowTextField.addKeyListener(new KeyListener() {
				public void keyTyped(KeyEvent paramAnonymousKeyEvent) {
				}

				public void keyPressed(KeyEvent paramAnonymousKeyEvent) {
					if ((paramAnonymousKeyEvent.getKeyCode() == 9) || (paramAnonymousKeyEvent.getKeyCode() == 524)
							|| (paramAnonymousKeyEvent.getKeyCode() == 157)
							|| (paramAnonymousKeyEvent.getKeyCode() == 0)) {

						return;
					}
					UserDefMacro.this.displayHotkey(paramAnonymousKeyEvent.getKeyCode(),
							paramAnonymousKeyEvent.getKeyLocation());
					paramAnonymousKeyEvent.consume();
				}

				public void keyReleased(KeyEvent paramAnonymousKeyEvent) {
				}
			});
		} else {
			this.jShowTextField.setText("");
		}
		return this.jShowTextField;
	}

	private JButton getJOKButton() {
		if (this.jOKButton == null) {
			this.jOKButton = new JButton();
			this.jOKButton.setText(LocaleStrings.getString("A_3_GLOBAL"));
			this.jOKButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					String str = UserDefMacro.this.jShowTextField.getText();
					if (UserDefMacro.this.model.size() < 20) {
						for (int i = 0; i < UserDefMacro.this.model.size(); i++) {
							if (UserDefMacro.this.model.elementAt(i).equals(str)) {
								JOptionPane.showMessageDialog(JViewerApp.getInstance().getMainWindow(),
										LocaleStrings.getString("T_19_UDM"), LocaleStrings.getString("T_1_UDM"), 1);

								UserDefMacro.this.jShowTextField.setText("");
								UserDefMacro.this.jShowTextField.requestFocus();
								UserDefMacro.this.code = "";
								return;
							}
						}
						if (str.length() > 0) {
							UserDefMacro.this.macroMap.put(str, UserDefMacro.this.code);
							UserDefMacro.this.model.addElement(str);
						}
						UserDefMacro.this.code = "";
						UserDefMacro.this.jShowTextField.setText("");
						UserDefMacro.this.jAddDialog.dispose();
						UserDefMacro.this.jAddDialog = null;
					} else {
						JOptionPane.showMessageDialog(JViewerApp.getInstance().getMainWindow(),
								LocaleStrings.getString("T_3_UDM") + 20 + LocaleStrings.getString("T_4_UDM"),
								LocaleStrings.getString("T_1_UDM"), 1);
					}
				}
			});
		}

		return this.jOKButton;
	}

	private JButton getJClearButton() {
		if (this.jClearButton == null) {
			this.jClearButton = new JButton();
			this.jClearButton.setText(LocaleStrings.getString("T_10_UDM"));
			this.jClearButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					String str1 = new String();
					String str2 = UserDefMacro.this.jShowTextField.getText();
					String[] arrayOfString1 = str2.split("[+]");
					String[] arrayOfString2 = UserDefMacro.this.code.split("[+]");
					String str3 = new String();
					String str4 = new String();
					int i;
					if (arrayOfString1.length != 0) {
						for (i = 0; i < arrayOfString1.length - 1; i++) {
							str3 = str3.concat(arrayOfString1[i]);
							str3 = str3.concat("+");
						}

						for (i = 0; i < arrayOfString2.length - 2; i++) {
							str4 = str4.concat(arrayOfString2[i]);
							str4 = str4.concat("+");
						}
					} else {
						str4 = "";
						UserDefMacro.this.code = "";
						str1 = "";
					}

					if (str3.length() > 1) {
						i = str3.lastIndexOf('+');
						int j = str4.lastIndexOf('+');
						str1 = str3.substring(0, i);
						UserDefMacro.this.code = str4.substring(0, j);
					} else {
						UserDefMacro.this.code = "";
					}
					UserDefMacro.this.jShowTextField.setText(str1);
					UserDefMacro.this.jShowTextField.setCaretPosition(0);
					UserDefMacro.this.jShowTextField.setRequestFocusEnabled(true);
					UserDefMacro.this.jShowTextField.requestFocus();
				}
			});
		}
		return this.jClearButton;
	}

	private JButton getJClearAllButton() {
		if (this.jClearAllButton == null) {
			this.jClearAllButton = new JButton();
			this.jClearAllButton.setText(LocaleStrings.getString("T_11_UDM"));
			this.jClearAllButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					UserDefMacro.this.jShowTextField.setText("");
					UserDefMacro.this.jShowTextField.requestFocus();
					UserDefMacro.this.code = "";
				}
			});
		}
		return this.jClearAllButton;
	}

	private JButton getJWindowsButton() {
		if (this.jWindowsButton == null) {
			this.jWindowsButton = new JButton();
			this.jWindowsButton.setText("Windows");
			this.jWindowsButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					String str1 = UserDefMacro.this.jShowTextField.getText();
					String str2 = Integer.toString(524);
					if (str1.length() == 0) {
						UserDefMacro.this.code = UserDefMacro.this.code.concat(str2);

						UserDefMacro.this.code = UserDefMacro.this.code.concat("+2");
						str1 = str1.concat("Windows(" + LocaleStrings.getString("T_12_UDM") + ")");
					} else {
						String[] arrayOfString = str1.split("[+]");
						JViewerApp.getInstance().getAddMacro();
						if (arrayOfString.length < 6) {
							UserDefMacro.this.code = UserDefMacro.this.code.concat("+" + str2);

							UserDefMacro.this.code = UserDefMacro.this.code.concat("+2");
							str1 = str1.concat("+Windows(" + LocaleStrings.getString("T_12_UDM") + ")");
						} else {
							UserDefMacro.this.maxMacroLimitMessage();
						}
					}
					UserDefMacro.this.jShowTextField.setText(str1);
					UserDefMacro.this.jShowTextField.requestFocus();
				}
			});
		}
		return this.jWindowsButton;
	}

	private JButton getJTabButton() {
		if (this.jTabButton == null) {
			this.jTabButton = new JButton();
			this.jTabButton.setText("Tab");
			this.jTabButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					String str1 = UserDefMacro.this.jShowTextField.getText();
					String str2 = Integer.toString(9);
					if (str1.length() == 0) {
						str1 = str1.concat("Tab");
						UserDefMacro.this.code = UserDefMacro.this.code.concat(str2);
						UserDefMacro.this.code = UserDefMacro.this.code.concat("+1");

					} else {
						String[] arrayOfString = str1.split("[+]");
						if (arrayOfString.length < 6) {
							UserDefMacro.this.code = UserDefMacro.this.code.concat("+" + str2);
							UserDefMacro.this.code = UserDefMacro.this.code.concat("+1");
							str1 = str1.concat("+Tab");
						} else {
							UserDefMacro.this.maxMacroLimitMessage();
						}
					}
					UserDefMacro.this.jShowTextField.setText(str1);
					UserDefMacro.this.jShowTextField.requestFocus();
				}
			});
		}
		return this.jTabButton;
	}

	private JButton getAltF4Button() {
		if (this.jAltF4Button == null) {
			this.jAltF4Button = new JButton();
			this.jAltF4Button.setText("Alt+F4");
			this.jAltF4Button.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					String str1 = UserDefMacro.this.jShowTextField.getText();
					String str2 = Integer.toString(18);
					if (str1.length() == 0) {
						str1 = str1.concat("Alt(" + LocaleStrings.getString("T_12_UDM") + ")");
						UserDefMacro.this.code = UserDefMacro.this.code.concat(str2);
						UserDefMacro.this.code = UserDefMacro.this.code.concat("+2");

						UserDefMacro.this.code = UserDefMacro.this.code.concat("+" + Integer.toString(115));
						UserDefMacro.this.code = UserDefMacro.this.code.concat("+1");
						str1 = str1.concat("+F4");
					} else {
						String[] arrayOfString = str1.split("[+]");
						if (arrayOfString.length < 5) {
							UserDefMacro.this.code = UserDefMacro.this.code.concat("+" + str2);
							UserDefMacro.this.code = UserDefMacro.this.code.concat("+2");
							str1 = str1.concat("+Alt(" + LocaleStrings.getString("T_12_UDM") + ")");

							UserDefMacro.this.code = UserDefMacro.this.code.concat("+" + Integer.toString(115));
							UserDefMacro.this.code = UserDefMacro.this.code.concat("+1");
							str1 = str1.concat("+F4");
						} else if (arrayOfString.length == 5) {
							JOptionPane.showMessageDialog(JViewerApp.getInstance().getMainWindow(),
									5 + LocaleStrings.getString("T_17_UDM") + "Alt+F4"
											+ LocaleStrings.getString("T_18_UDM"),
									LocaleStrings.getString("T_7_UDM"), 1);

						} else {

							UserDefMacro.this.maxMacroLimitMessage();
						}
					}
					UserDefMacro.this.jShowTextField.setText(str1);
					UserDefMacro.this.jShowTextField.requestFocus();
				}
			});
		}
		return this.jAltF4Button;
	}

	private JButton getPrintScreen() {
		if (this.jPrintScreen == null) {
			this.jPrintScreen = new JButton();
			this.jPrintScreen.setText("Print Screen");
			this.jPrintScreen.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent paramAnonymousActionEvent) {
					String str1 = UserDefMacro.this.jShowTextField.getText();
					String str2 = Integer.toString(154);
					if (str1.length() == 0) {
						str1 = str1.concat("Print Screen");
						UserDefMacro.this.code = UserDefMacro.this.code.concat(str2);
						UserDefMacro.this.code = UserDefMacro.this.code.concat("+1");

					} else {
						String[] arrayOfString = str1.split("[+]");
						if (arrayOfString.length < 6) {
							UserDefMacro.this.code = UserDefMacro.this.code.concat("+" + str2);
							UserDefMacro.this.code = UserDefMacro.this.code.concat("+1");
							str1 = str1.concat("+Print Screen");
						} else {
							UserDefMacro.this.maxMacroLimitMessage();
						}
					}
					UserDefMacro.this.jShowTextField.setText(str1);
					UserDefMacro.this.jShowTextField.requestFocus();
				}
			});
		}
		return this.jPrintScreen;
	}

	public UserDefMacro(Frame paramFrame) {
		super(paramFrame);
		initialize();

		this.code = new String();
		if (this.macroMap == null) {
			this.macroMap = new HashMap();
		}

		HashMap localHashMap = JViewerApp.getInstance().getAddMacro().getMacroMap();
		this.previousMap = new HashMap();
		Set localSet = localHashMap.entrySet();

		Iterator localIterator = localSet.iterator();
		while (localIterator.hasNext()) {
			Map.Entry localEntry = (Map.Entry) localIterator.next();
			this.previousMap.put((String) localEntry.getKey(), (String) localEntry.getValue());
		}
	}

	private void initialize() {
		setSize(615, 355);
		getContentPane().setLayout(new BorderLayout());
		getContentPane().add(getJContentPane(), "Center");
		getContentPane().add(getButtonPanel(), "South");
		setTitle(LocaleStrings.getString("T_1_UDM"));
		setResizable(false);
		setVisible(true);
		setLocation(JViewerApp.getInstance().getPopUpWindowPosition(615, 355));
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent paramAnonymousWindowEvent) {
				UserDefMacro.this.onCloseDialog();
			}
		});
	}

	private JPanel getJContentPane() {
		if (this.jContentPane == null) {
			this.jContentPane = new JPanel();
			this.jContentPane.setLayout(null);
			this.jContentPane.add(getJList(), null);
			this.jContentPane.setVisible(true);
		}
		return this.jContentPane;
	}

	private JPanel getButtonPanel() {
		if (this.buttonPanel == null) {
			this.buttonPanel = new JPanel(new FlowLayout(2, 10, 10));
			this.buttonPanel.add(getJAddButton(), null);
			this.buttonPanel.add(getJDeleteButton(), null);
			this.buttonPanel.add(getJCloseButton(), null);
			this.buttonPanel.setVisible(true);
		}
		return this.buttonPanel;
	}

	public void displayHotkey(int paramInt1, int paramInt2) {
		String str1 = null;
		String str2 = this.jShowTextField.getText();
		String[] arrayOfString = str2.split("[+]");

		str1 = KeyEvent.getKeyText(paramInt1);
		if (str1.equals("NumPad +")) {
			str1 = "NumPad " + LocaleStrings.getString("T_16_UDM");
		}
		if (arrayOfString.length < 6) {
			String str3;
			if (str2.length() == 0) {
				this.jShowTextField.append(str1);
				if (paramInt2 != 1) {
					switch (paramInt2) {
					case 2:
						this.jShowTextField.append("(" + LocaleStrings.getString("T_12_UDM") + ")");
						break;
					case 3:
						this.jShowTextField.append("(" + LocaleStrings.getString("T_13_UDM") + ")");
						break;
					}

				}

				str3 = Integer.toString(paramInt1);
				this.code = this.code.concat(str3);
				this.code = this.code.concat("+" + paramInt2);

			} else {

				str3 = Integer.toString(paramInt1);
				this.code = this.code.concat("+" + str3);
				this.code = this.code.concat("+" + paramInt2);
				this.jShowTextField.append("+" + str1);
				if (paramInt2 != 1) {
					switch (paramInt2) {
					case 2:
						this.jShowTextField.append("(" + LocaleStrings.getString("T_12_UDM") + ")");
						break;
					case 3:
						this.jShowTextField.append("(" + LocaleStrings.getString("T_13_UDM") + ")");
						break;

					}

				}
			}
		} else {
			maxMacroLimitMessage();
		}
	}

	public boolean isAddMacro() {
		return this.addMacro;
	}

	private void maxMacroLimitMessage() {
		JOptionPane.showMessageDialog(JViewerApp.getInstance().getMainWindow(),
				LocaleStrings.getString("T_14_UDM") + 6 + LocaleStrings.getString("T_15_UDM"),
				LocaleStrings.getString("T_7_UDM"), 1);
	}
}

/*
 * Location:
 * D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\kvm\jviewer\gui\UserDefMacro.
 * class Java compiler version: 5 (49.0) JD-Core Version: 0.7.1
 */